package com.fire.market.config;

/**
 * Swagger2Config
 *
 * @author zwd
 * @date 2021/7/16
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;
import java.util.List;

/**
 * Swagger2API文档的配置
 * http://localhost:8002/doc.html
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {
    @Bean
    public Docket baseRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("spring cloud dubbo test")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.fire.market"))
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("测试接口文档")
                .description("测试股接口文档Swagger版")
                .termsOfServiceUrl("http://zwd.com")
                .contact(new Contact("哈哈哈","http://zwd.com", ""))
                .version("1.0")
                .build();
    }
}
